package com.wmzdq.photocenter.main;

import java.io.File;
import java.io.IOException;
import java.util.Collection;

import net.coobird.thumbnailator.Thumbnails;

import org.apache.commons.io.FileUtils;

import com.wmzdq.photocenter.file.LocalOperator;

public class CreateThum {

	public static void main(String[] args) throws IOException {
		String filepath="D:\\photos";
		String thum="thum";
		String create="ysy";
		
		File createFile=new File(filepath+File.separator+create);
		File thumFile=new File(filepath+File.separator+create+File.separator+thum);
		if(createFile.exists()){
			if(!thumFile.exists()){
				thumFile.mkdir();
			}
			Collection<File > files=FileUtils.listFiles(createFile, new String[]{"JPG","jpg"},false);
			for (File file : files) {
				File outFile=new File(filepath+File.separator+create+File.separator+thum+File.separator+file.getName());
				Thumbnails.of(file).scale(0.5f) .outputQuality(0.5f) .outputFormat("jpg").toFile(outFile);
			}
		}

	}

}
